package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 小懒虫
 * @date 2018/8/14
 */
@Data
@Entity
@Table(name = "pcs_porter_permission")
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_porter_permission" + StatusUtil.SLICE_DELETE)
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("护理权限")
public class PorterPermission implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @CreatedDate
    @Excel("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    @Transient
    private String createTimeStr;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @Excel("护工ID")
    @JoinColumn(name = "porterId")
    private Long porterId;

    @Excel("科室ID")
    private String depId;

    @Excel("审核状态 -1 待提交 0 待审核 1 已通过 2 已驳回")
    private Integer verifyStatus;

    @Excel("审核状态 -1 待提交 0 待审核 1 已通过 2 已驳回")
    private Integer canalStatus;

    @Excel("备注 / 驳回理由")
    private String remark;

    @Excel("护理公司ID")
    private Long companyId;

    @Excel("科室名称")
    private String depName;

    @Excel("护工名称")
    private String porterName;
    private String companyName;

    private Byte status = StatusEnum.OK.getCode();

    @Transient
    @Excel("性别 1 男 2 女")
    private Byte sex; // 新增字段
    @Excel("手机号")
    @Transient
    private String phone; // 新增字段
    @Transient
    private Integer age;


    private String canalRemark;
    private String canalName;
    private String canalTime;
    private String canalBRemark;
}
